<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../vue.js"></script>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        #root {

            position: relative;
        }

        #root .center a {
            text-decoration: none;
            width: 45px;
            height: 100px;
            position: absolute;
            top: 179px;
            vertical-align: middle;
            opacity: 0.5;
            
        }


        #root .center>img {
            display: block;
            width: 700px;
            height: 458px;
        }

        #root .center .left {
            left: 15px;
            text-align: left;
            padding-right: 10px;
            border-top-right-radius: 10px;
            border-bottom-right-radius: 10px;
            transform: translate(640px);
        }

        #mask .center .right {
            right: 15px;
            text-align: right;
            padding-left: 10px;
            border-top-left-radius: 10px;
            border-bottom-left-radius: 10px;
            
        }
    </style>
</head>

<body>
    <div id="root">
        <div class="center">

            <img :src="imgArr[index]" alt="">
            <!--左箭头-->
            <a href="javascript:void(0)" v-if="index!=0" @click="pre" class="right">
                <img src="./images/prev.png" alt="">
            </a>
            <!--右箭头-->
            <a href="javascript:void(0)" v-show="index<imgArr.length-1" @click="next" class="left">
                <img src="./images/next.png" alt="">
            </a>

        </div>
    </div>
    <script>
        new Vue({
            el: "#root",
            data: {
                imgArr: [
                    "./images/00.jpg",
                    "./images/01.jpg",
                    "./images/02.jpg",
                    "./images/03.jpg",
                ],
                index: 0
            },
            methods: {
                pre() {
                    this.index--;
                },

                next() {
                    this.index++;
                }

            },
        })
    </script>
</body>

</html>